package uit.nfcmenu.util;

import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Locale;

public class CommConstant {
	//static String tag = CommConstant.class.getSimpleName();

	public static final String IS_WAITER = "IS_WAITER";

	public static final String SDCARD_PATH = "/sdcard/VisualMenu/";

	public static final String SIGN_NULL = "null";
	public static final String SIGN_EMPTY = "";
	public static final String SIGN_TRUE = "true";
	public static final String SIGN_FALSE = "false";

	public static final byte CHANGED_MENU = 1;
	public static final byte CHANGED_ITEM = 2;
	public static final byte CHANGED_ORDER = 4;
	public static final long TWO_DATE=2*24*60*60*1000;

	/*
	 * status in order process
	 */

	public static final int STATUS_NEW = 0;
	public static final int STATUS_COOKING = 1;
	public static final int STATUS_COOKED = 2;
	public static final int STATUS_SERVED = 3;
	public static final int STATUS_DENY = 4;
	public static final int STATUS_DONE = 5;

	
	private static Integer[] lstWaiterOrderNew = {
		STATUS_COOKING, 
		STATUS_COOKED,
		STATUS_SERVED
	};
	
	public static ArrayList<Integer[]> mWaiterOrderStatus = new ArrayList<Integer[]>()
			{{add(lstWaiterOrderNew);}};

	public static String[] mOrderStatus;

	/*
	 * get data success in response by getting on server		
	 */


	public static ArrayList<String> request = new ArrayList<String>();
	public static ArrayList<String> savedRequests = new ArrayList<String>();
	public static boolean isWaiter = false;
	public static String[] mOrderLanguage;

	public static void initData(String[] orderStatuses, String[] languages) {
		mOrderStatus = orderStatuses;
		mOrderLanguage = languages;
	}
	
	
	
	public static String getStatusViaLanguage(String value){
		String kq=mOrderStatus[0];
		for(int i=0;i<mOrderLanguage.length;i++){
			if(value.equals(mOrderLanguage[i])){
				return mOrderStatus[i];
			}
		}
		
		return kq;
	}
	
	public static String getStatusLanguage(String value){
		String kq=mOrderLanguage[0];
		for(int i=0;i<mOrderStatus.length;i++){
			if(value.equals(mOrderStatus[i])){
				return mOrderLanguage[i];
			}
		}
		
		return kq;
	}
	
	public static int getStatus(String input) {
		int kq = -1;
		for (int i = 0; i < mOrderStatus.length; i++) {
			if (mOrderStatus[i].equals(input)) {
				return i;
			}
		}
		return kq;
	}

	/*
	 * timer
	 */
	public static int TIME_PAUSE_UPDATE_DATA = 30000; // 1'
	public static int TIME_PAUSE_UPDATE_VIEW = 10000; // 10s

	public static Hashtable<Integer, String> item;
	public static Hashtable<Integer, String> menuImgLinks;
	public static Hashtable<Integer, Integer> itemsMenus;
	public static int isWrite = 0;

	/*
	 * Languages
	 */
	public static final String LANGUAGE_VI = "vi";
	
	public static final int LANGUAGE_EN_INDEX = 0;
	public static final int LANGUAGE_JA_INDEX = 1;
	public static final int LANGUAGE_VI_INDEX = 2;
	
	public static String[] ARR_LANGUAGE;
	public static int LANGUAGE_INDEX = 0;
	
	public static int DELAY_TIME = 60000;
	public static int SHEDULE_TIME = 30000;

	public static int getLanguageIndex(String language) {
		if (Locale.JAPANESE.getLanguage().equals(language)) {
			return LANGUAGE_JA_INDEX;
		} else if (LANGUAGE_VI.equals(language)) {
			return LANGUAGE_VI_INDEX;
		}
		return LANGUAGE_EN_INDEX;
	}
}
